[PATCH] MDEV-38046 Make func_regexp_pcre tolerant to PCRE2 offset change
authorAquila Macedo <aquilamacedo@riseup.net>
Sat, 8 Nov 2025 00:09:05 +0000 (21:09 -0300)
committerOtto Kekäläinen <otto@debian.org>
Tue, 13 Jan 2026 19:03:57 +0000 (19:03 +0000)
PCRE2 10.47 reports the invalid escape in 'A\q' at offset 3 instead of 2.
Update the expected result and add a --replace_regex in the test so the
suite passes with both older and newer PCRE2 versions.

Forwarded: https://jira.mariadb.org/browse/MDEV-38046
(accepted upstream, will be in MariaDB 11.8.6+)

Gbp-Pq: Name MDEV-38046-pcre2-offset.patch

mysql-test/main/func_regexp_pcre.result
mysql-test/main/func_regexp_pcre.test

index 4416dfc4ccfa94e7cecab3aee11f4816fcc9e35c..dff12c66362ad0e816041bff99265c5d73af7c81 100644 (file)
@@ -791,7 +791,7 @@ SELECT 'AB' RLIKE 'A# this is a comment\nB';
 1
 SET default_regex_flags=DEFAULT;
 SELECT 'Aq' RLIKE 'A\\q';
-ERROR 42000: Regex error 'unrecognized character follows \ at offset 2'
+ERROR 42000: Regex error 'unrecognized character follows \ at offset 3'
 SET default_regex_flags='EXTRA';
 SELECT 'A' RLIKE 'B';
 'A' RLIKE 'B'
index f214ee6db0775b530f5d1c0ae045fb655854d3bd..260a24801bd83273cfd0f04ea04d05fc58c85ec6 100644 (file)
@@ -382,6 +382,8 @@ SELECT 'AB' RLIKE 'A B';
 SELECT 'AB' RLIKE 'A# this is a comment\nB';
 SET default_regex_flags=DEFAULT;
 
+# pcre2 versions differ in the reported error offset for invalid escapes
+--replace_regex /offset 2/offset 3/
 --error ER_REGEXP_ERROR
 SELECT 'Aq' RLIKE 'A\\q';